/*
 *  process.h
 *
 *  Created on: May 15, 2011
 *  Author: Sergiy Kulyk
 */

#ifndef PROCESS_H_
#define PROCESS_H_

/*******************************************************************
 * 		Request													   *
 ******************************************************************/
enum s_request_type_t {
    IO,
    SYS
};

typedef struct req {
    int    step;	// step number on which this request should occur
    enum s_request_type_t type;	// request type

} s_request_type_t;


/**
 * Request type constructor.
 */
s_request_type_t * s_new_request_type(const int step,
                                      const enum s_request_type_t type);



/*******************************************************************
 * 		Process													   *
 ******************************************************************/

typedef struct p_str {
    int		num_steps;	// number of instructions (before resetting to 0)
    int 	num_requests;	// number of requests generated during one full run
    s_request_type_t * req_type; // array of request types
    enum s_process_type_t {
        CALCULATING,
        PRODUCER,
        CONSUMER
    }	process_type;	// type of the process
} s_process_t;


/**
 * Process constructor. Returns a pointer to a new process record, or
 * a null pointer if it was unable to obtain memory for it.
 */
s_process_t * s_new_process(const int steps,
                            const int num_req,
                            s_request_type_t * req_type,
                            enum s_process_type_t p_type);


#endif /* PROCESS_H_ */
